package com.dubito.dao.impl;

import java.util.List;

import org.apache.ibatis.session.SqlSession;

import com.dubito.entity.Dept;
import com.dubito.entity.Emp;
import com.dubito.utils.MyBatisUtil;

public class DeptDaoImpl {

	SqlSession session;
	public List<Emp> selectEmpDeptList(Emp emp){
		List<Emp> emps=null;
		try{
		session=MyBatisUtil.getSession();
		emps=session.selectList("com.dubito.entity.EmpMapper.selectEmpDeptList",emp);
		session.commit();
		}catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
			session.rollback();
		}finally{
			MyBatisUtil.closeSession();
		}
		return emps;
	}
	public List<Dept> selectDeptEmpList(Dept dept){
		List<Dept> depts=null;
		try{
			session=MyBatisUtil.getSession();
			depts=session.selectList("com.dubito.entity.DeptMapper.selectDeptEmpList",dept);
			session.commit();
		}catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
			session.rollback();
		}finally{
			MyBatisUtil.closeSession();
		}
		return depts;
	}
	
}
